package com.huawei.appgallery.forum.user.usercenter.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import com.huawei.appgallery.forum.base.https.jgw.JGWTabDetailResponse;
import com.huawei.appgallery.forum.base.ui.JGWTabFragment;
import com.huawei.appgallery.forum.cards.bean.ForumPostCardBean;
import com.huawei.appgallery.forum.user.api.IUserHomePageProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.LayoutData;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.hmf.annotation.FragmentDefine;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;
import java.util.List;
import o.bqv;
import o.bqx;
import o.brv;
import o.bsl;
import o.bsn;
import o.bsv;
import o.cbb.a;
import o.cbb.j;
import o.cia;
import o.ContentManager;
import o.ll;

@FragmentDefine(alias = "UserHomeTabFavoriteFragment", protocol = IUserHomePageProtocol.class)
public class UserHomeTabFavoriteFragment extends JGWTabFragment {
    private SafeBroadcastReceiver ﾞ = new SafeBroadcastReceiver(this) {
        final /* synthetic */ UserHomeTabFavoriteFragment ˏ;

        {
            this.ˏ = r1;
        }

        public void onReceiveMsg(Context context, Intent intent) {
            if (context == null || intent == null || this.ˏ.ͺˎ == null) {
                bqx.ॱ("UserHomeTabFragment", "onReceive, context = " + context + ", intent = " + intent + ", listView = " + this.ˏ.ͺˎ);
                return;
            }
            if (bsn.ˋ.equals(intent.getAction())) {
                Bundle extras = intent.getExtras();
                if ((this.ˏ.י instanceof brv) && extras != null) {
                    if (((brv) this.ˏ.י).ॱ(extras.getString("cardId"))) {
                        int ˊॱ = this.ˏ.י.ˊॱ();
                        if (this.ˏ.ꜝ() > 1 || ˊॱ != 0) {
                            this.ˏ.י.ͺ();
                            return;
                        }
                        this.ˏ.ˋॱ(false);
                        bqx.ˊ("UserHomeTabFragment", "show noDataView, provider is empty");
                    }
                }
            }
        }
    };

    public void ˏ(Bundle bundle) {
        IUserHomePageProtocol iUserHomePageProtocol = (IUserHomePageProtocol) this.ﹳ.ॱ();
        bqv ॱ = bsv.ॱ(iUserHomePageProtocol.getDomainId());
        ॱʾ();
        this.ʼ = new bsl(this, "", iUserHomePageProtocol.getUri(), ॱ);
        ˊ(iUserHomePageProtocol);
        super.ˏ(bundle);
    }

    private void ˊ(IUserHomePageProtocol iUserHomePageProtocol) {
        if (TextUtils.isEmpty(iUserHomePageProtocol.getUri())) {
            this.ʼᐝ = iUserHomePageProtocol.toString().hashCode();
        } else {
            this.ʼᐝ = iUserHomePageProtocol.getUri().hashCode();
        }
    }

    public cia ˊ(Context context) {
        return new brv(context);
    }

    public void ˌॱ() {
        super.ˌॱ();
        ll.ˏ(ContentManager.getInstant().getContext()).ˏ(this.ﾞ, new IntentFilter(bsn.ˋ));
    }

    public void ˋʼ() {
        super.ˋʼ();
        ll.ˏ(ContentManager.getInstant().getContext()).ˋ(this.ﾞ);
    }

    public void ͺˏ() {
        if (this.ߴ != null) {
            this.ߴ.setWarnImage(י());
            this.ߴ.setWarnTextOne(ՙ());
            this.ߴ.setViewVisible(e.WARN_BTN, 8);
            this.ߴ.setViewVisible(e.WARN_TEXTTWO, 8);
        }
    }

    private void ॱʾ() {
        ʻ(a.ʻ);
        ʼ(j.ॱˋ);
    }

    public boolean ˊ(TaskFragment taskFragment, b bVar) {
        if (bVar.ˋ.getResponseCode() == 0 && bVar.ˋ.getRtnCode_() == 0 && (bVar.ˋ instanceof JGWTabDetailResponse)) {
            List<LayoutData> ᐝॱ = ((JGWTabDetailResponse) bVar.ˋ).ᐝॱ();
            if (ᐝॱ != null && ᐝॱ.size() > 0) {
                for (LayoutData layoutData : ᐝॱ) {
                    if ("forumpostcard".equals(layoutData.ˏ()) && layoutData.ˋ().size() != 0) {
                        for (ForumPostCardBean ˏ : layoutData.ˋ()) {
                            ˏ.ˏ(2);
                        }
                    }
                }
            }
        }
        return super.ˊ(taskFragment, bVar);
    }
}
